package com.situ.mall.web.controller;

import com.situ.mall.common.service.ICartService;
import com.situ.mall.common.service.IMemberAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
public class ConfirmController {

    @Autowired
    private ICartService cartService;
    @Autowired
    private IMemberAddressService memberAddressService;

    @PostMapping("/confirm")
    public String confirm(String ids, Model model) {

//        req.getParamemter("ids");
//        req.setAttribute("a","b");
        //model.addAttribute("ids",ids);
        model.addAttribute("cartList", cartService.selectByIds(ids));
        model.addAttribute("addressList", memberAddressService.getCurrentMemberAddress());

        return "confirm";
    }
}
